<?php
class Application_Helper_Session
{
	private static $_instance = null;
	
	private $_namespace = null;
	
	private static function _getInstance()
	{
		if(self::$_instance == null)
		{
			self::$_instance = new self();
		}
		return self::$_instance;
	}
	
	private function __construct()
	{
		$this->_namespace = new Zend_Session_Namespace('mysession');
	}
	
	private function _get($key, $default = null)
	{
		if (isset($this->_namespace->{$key})) 
		{
			return $this->_namespace->{$key};
		} 
		else 
		{
			return $default;
		}
	}
	
	private function _set($key, $value)
	{
		$this->_namespace->{$key} = $value;
	}
	
	private function _remove($key)
	{
		if(isset($this->_namespace->{$key}))
		{
			unset($this->_namespace->{$key});
		}
	}
	
	public static function get($key, $default = null)
	{
		$instance = self::_getInstance();
		
		return $instance->_get($key, $default);
	}
	
	public static function set($key, $value)
	{
		$instance = self::_getInstance();
		
		$instance->_set($key, $value);
	}
	
	public static function remove($key)
	{
		$instance = self::_getInstance();
		
		$instance->_remove($key);
	}
}